/**
 * Created by Administrator on 2017/12/18 0018.
 */
define([],function(){
    var tpl = {};
    tpl.quesInit = function(){
        var html = '';
        html += text();
        html += date();
        html += select();
        html += group();
        html += total();
        return html;
    }
    var total = function(){
        return  '<script id="tpl_question_total" type="text/html">'+
                '           <div class="item-title">请填写建档信息</div>'+
                '           <div class="clearfix questiones">'+
                '              <form id = "questiones_form" name = "questiones_form">'+
                '               {{include "tpl_question_group"}}'+
                '               </form>'+
                '           </div>'+
                '           <div>'+
                '               <div class="btn btn-yellow" id="nextOperate">下一步</div>'+
                '           </div>'+
                '</script>';
    }
    var group = function(){
        return  '<script id="tpl_question_group" type="text/html">'+
                /*'           {{if showLabel}}'+
                '               <div id="{{id}}" {{if relationId}}relationId="{{relationId}}"{{/if}} class="qaCard-subtit col-sm-12 col-md-12 {{if showIcon}} has-icon{{/if}}">'+
                '                   <div>'+
                '                       {{if showIcon}}<i class="fa fa-file-text"></i>{{/if}}'+
                '                       <span>{{label}}</span>'+
                '                   </div>'+
                '               </div>'+
                '           {{/if}}'+*/
                '           {{each children as value i}}'+
                '               {{if value.type=="qusetion_group"}}'+
                '                   {{include "tpl_question_group",value}}'+
                '               {{else if value.type=="question_text"}}'+
                '                   {{include "tpl_question_text",value}}'+
                '               {{else if value.type=="question_date"}}'+
                '                   {{include "tpl_question_date",value}}'+
                '               {{else if value.type=="question_select"}}'+
                '                   {{include "tpl_question_select",value}}'+
                '               {{/if}}'+
                '           {{/each}}'+
                '</script>';
    }
    /*
    *  输入框：
     */
    var text = function(){
        return  '<script id="tpl_question_text" type="text/html">'+
                '   <div  class="qaCard form-group form-group-sm col-sm-{{length}} col-md-{{length}} grid-label-{{labelLength}}">'+
                '       <label class="control-label">{{label}}</label>'+
                '       <div class="control-input">'+
                /*'           {{if status=="default"}}'+*/
                '               <input type="text" class="form-control validatebox" name="{{name}}" value="{{val}}" data-validate="{{validate}}" data-attention="{{attention}}" placeholder="{{placeHolder}}" autocomplete="off">'+
                /*'           {{else if status=="readonly"}}'+
                '               <p class="form-control-static" name="{{name}}">{{val}}</p>'+
                '           {{else if status=="disabled"}}'+
                '               <input type="text" class="form-control" name="{{name}}" value="{{val}}" placeholder="{{placeHolder}}" disabled>'+
                '           {{/if}}'+*/
                '       </div>'+
                '   </div>'+
                '</script>';
    }
    /*
    * 日期：
     */
    var date = function(){
        return  '<script id="tpl_question_date" type="text/html">'+
                '   <div {{if relationId}}relationId="{{relationId}}"{{/if}} class="qaCard form-group form-group-sm col-sm-{{length}} col-md-{{length}} grid-label-{{labelLength}}">'+
                '       <label class="control-label">{{label}}</label>'+
                '       <div class="control-input">'+
                /*'           {{if status=="default"}}'+*/
                '               <input type="date" min="{{min}}" max="{{max}}" class="form-control validatebox" name="{{name}}" value="{{val}}" data-validate="{{validate}}" data-attention="{{attention}}" placeholder="{{placeHolder}}">'+
                /*'           {{else if status=="readonly"}}'+
                '               <p class="form-control-static" name="{{name}}">{{val}}</p>'+
                '           {{else if status=="disabled"}}'+
                '               <input type="date" min="{{min}}" max="{{max}}" class="form-control" name="{{name}}" value="{{val}}" placeholder="{{placeHolder}}" disabled>'+
                '           {{/if}}'+*/
                '       </div>'+
                '   </div>'+
                '</script>';
    }
    /*
    * select
     */
    var select = function(){
        return  '<script id="tpl_question_select" type="text/html">'+
                '   <div {{if relationId}}relationId="{{relationId}}"{{/if}} class="qaCard form-group form-group-sm col-sm-{{length}} col-md-{{length}} grid-label-{{labelLength}}">'+
                '       <label class="control-label">{{label}}</label>'+
                '       <div class="control-input">'+
                /*'           {{if status=="default"}}'+*/
                '               <select class="form-control validatebox" name="{{name}}" data-validate="{{validate}}" data-attention="{{attention}}">'+
                '                   {{each list as item i}}'+
                '                       {{if val==item.key}}'+
                '                           <option value="{{item.key}}" selected="selected">{{item.key}}</option>'+
                '                       {{else}}'+
                '                           <option value="{{item.key}}">{{item.key}}</option>'+
                '                       {{/if}}'+
                '                   {{/each}}'+
                '               </select>'+
                /*'           {{else if status=="readonly"}}'+
                '               {{if val!=null&&val.length>0}}'+
                '                   {{each list as item i}}'+
                '                       {{if val===item.key}}'+ 
                '                           <p class="form-control-static" name="{{name}}" data-val="{{item.key}}">{{item.key}}</p>'+
                '                       {{/if}}'+
                '                   {{/each}}'+
                '               {{else}}'+
                '                   <p class="form-control-static">无</p>'+
                '               {{/if}}'+
                '           {{else if status=="disabled"}}'+
                '               <select class="form-control" name="{{name}}" disabled>'+
                '                   {{each list as item i}}'+
                '                       {{if val==item.key}}'+
                '                           <option value="{{item.key}}" selected="selected">{{item.key}}</option>'+
                '                       {{else}}'+
                '                           <option value="{{item.key}}">{{item.key}}</option>'+
                '                       {{/if}}'+
                '                   {{/each}}'+
                '               </select>'+
                '           {{/if}}'+*/
                '       </div>'+
                '   </div>'+
                '</script>';
    }
    return tpl;
});
